package com.example.smokealarm.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.InetAddress;

@RestController
public class ServerInfoController {

    @GetMapping("/api/server-info")
    public String getServerInfo() {
        try {
            InetAddress ip = InetAddress.getLocalHost();
            return "http://" + ip.getHostAddress() + ":8080";
        } catch (Exception e) {
            return "Error: " + e.getMessage();
        }
    }
}